class Container {
  constructor(value) {
    this._value = value; // 这个值不对外公布
  }

  map(fn) {
    return Container.of(fn(this._value));
  }

  // 避免使用 new
  static of(value) {
    return new Container(value);
  }
}


class MayBe {
  constructor(value) {
    this._value = value;
  }

  static of(value) {
    return new MayBe(value);
  }

  map(fn) {
    return this.isNoting() ? MayBe.of(null) : MayBe.of(fn(this._value));
  }

  isNoting() {
    return this._value == null;
  }
}

module.exports = {
	Container,
	MayBe
}